<template>
  <div class="exhibitions-box">
    <p class="name-box name-box-mg">看展览</p>

    <div class="exhibitions-item-parent" @click="lookPath(item.refId)" v-for="(item, index) in props.list" :key="index">
      <div class="exbit-item-before"></div>
      <div class="exhibitions-item" :class="{ 'exhibitions-item-center': index === 1 }">
        <a
          @click.stop="chageOn" 
          target="_blank"
          :href="cancatUrl + 'web/' + item.refId"
          class="item-left"
          v-if="index !== 1"
        >
          <div>
            <div class="item-title">
              <span>
                {{ item.name }}
                <span class="solid"></span>
              </span>
            </div>
            <div class="item-avatar">
              <div class="auth-avatar-box-home">
                <t-avatar
                  size="28px"
                  :image="
                    item.orgCoverUrl
                      ? urls + item.orgCoverUrl + '?imageView2/2/w/28/h/28/format/webp'
                      : publicUrls + 'assets/img/companyImg.png'
                  "
                ></t-avatar>
                <img
                  v-if="item.orgAuthType > 0"
                  class="auth-avatar-box-home-img"
                  src="//static.jiyi.show/door/isAuthIcon.svg"
                  alt=""
                />
              </div>

              <span class="avatar-name">{{ item.orgName }}</span>
            </div>
          </div>

          <div class="item-description-font-size">
            {{ item.description }}
          </div>
        </a>
        <div class="item-left-fit" v-if="index === 1"></div>
        <div class="item-right" :class="{ 'item-right-center': index == 1 }">
          <div class="item-right-after"></div>
          <div class="right-shadow"></div>
          <div class="right-star">
            <infoStar
              @starEmit="starEmit"
              :index="index"
              :info="item"
              :shearUrl="cancatUrl + 'web/' + item.refId" 
            />
          </div>
          <img
            class="t-image t-image--fit-cover t-image--position-center"
            :src="urls + item.coverUrl + '?imageView2/0/w/1042/format/webp'"
            alt=""
          />
        </div>
        <div class="item-left-fit" v-if="index !== 1"></div>
        <a
          @click.stop="chageOn"
          target="_blank"
          :href="cancatUrl + 'web/' + item.refId"
          class="item-left item-left-center"
          v-if="index == 1"
        >
          <div>
            <div class="item-title">
              <span>
                {{ item.name }}
                <span class="solid"></span>
              </span>
            </div>
            <div class="item-avatar">
              <div class="auth-avatar-box-home">
                <t-avatar
                  size="28px"
                  :image="
                    item.orgCoverUrl
                      ? urls + item.orgCoverUrl + '?imageView2/2/w/28/h/28/format/webp'
                      : publicUrls + 'assets/img/companyImg.png'
                  "
                ></t-avatar>
                <img
                  v-if="item.orgAuthType > 0"
                  class="auth-avatar-box-home-img"
                  src="//static.jiyi.show/door/isAuthIcon.svg"
                  alt=""
                />
              </div>
              <!-- <t-avatar size="24px" :image="urls + item.orgCoverUrl + '?imageView2/2/w/28/h/28/format/webp'"></t-avatar> -->
              <span class="avatar-name">{{ item.orgName }}</span>
            </div>
          </div>
          <div class="item-description-font-size">
            {{ item.description }}
          </div>
        </a>
      </div>
    </div>
    <div class="btm-box"></div>
  </div>
</template> 

<script setup lang="ts">
// @ts-nocheck
import { publicUrls } from '@/utils/minxin';
import { linkurl } from '@/utils/minxin';
import { cancatUrl } from '@/utils/minxin';
import infoStar from '@/components/infoStar/infoStar.vue';
import { list1 } from './data';
import { pathSquare } from '@/utils/minxin';
import { addBrowseTemplate } from '@/utils/minxin';
import { configData } from '@/api/templates/templates';
import { AddLike, AddFollow } from '@/api/door/door';
import { urls } from '@/utils/request/upload';
import { onMounted, ref, onUnmounted, nextTick } from 'vue';
import { useRouter } from 'vue-router';
import { recommendList } from '@/api/door/door';
import { useProjectStore } from '@/store';

const store = useProjectStore();
const fadeInElements = ref([]);
const router = useRouter();
const props = defineProps({
  list: {
    type: Object,
  },
});
const emit = defineEmits(['starEmitParent']);
const like = async (e: number) => {
  try {
    let { statusCode } = await AddLike({
      refType: 3,
      refId: list.value[e].refId,
    });
    if (statusCode == 200) {
      list.value[e].likeTotal = list.value[e].likeTotal + 1;
    }
  } catch {}
};
const starEmit = async (e?: number) => {
  try {
    let { statusCode } = await AddFollow({
      refType: 3,
      refId: props.list[e].refId,
    });
    if (statusCode == 200) {
      emit('starEmitParent', e);
    }
  } catch (err) {
    console.log(err);
  }
};
const pathVisitExhibits = () => {
  router.push({ path: '/exhibitions' });
};
const chageOn = () => {};
const lookPath = (e: number) => {
  let url = cancatUrl +'web/'+ e; 
  window.open(url, '_blank');
};
</script>

<style lang="less" scoped>
@import '../index.less';
@import './exhit.less';
</style>